<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.burger.counter.beans.ShoppingCart"%>
<%@page import="com.burger.counter.beans.Item"%>
<%@page import="com.burger.counter.beans.User"%>
<%
	Double subTotal = 0.0;
	ShoppingCart cart;
	Item item;
	Double tax=0.0;
	Double total=0.0;
	User user=null;
	ArrayList<Item> itemList;
	tax=(Double)session.getAttribute("Tax");
	total=(Double)session.getAttribute("Total");
	subTotal=(Double)session.getAttribute("SubTotal");
	System.out.println("Calling viewreceipt");
	%>
<%
	cart = (ShoppingCart) session.getAttribute("Cart");
	user = (User)session.getAttribute("User");
	
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<link rel="stylesheet" href="default.css" type="text/css"></link>
	<%@ include file="header.jsp"%>
	<form name="ViewOrder" method="post" action="HandleOrderServlet">
		<div class="inputColumn" id="viewOrder"
			style="text-align: center; border: thin; margin: auto;">
			<table border="1">
				<tr>
				<td bordercolor="red" bordercolor="white"><label
						name="CustomerName" style="size: 30;"><%=user.getFirstName() + " " + user.getLastName()%></label>
					</td>
				</tr>
				<%
				if(cart!=null)
				{
					int i;
					itemList=(ArrayList<Item>) cart.getItemInCart();	
					for (i = 0; i < itemList.size(); i++) {
						item=itemList.get(i);
						
				%>
				<tr bordercolor="red" style="border-style: none" bordercolor="white">
				<td bordercolor="red" bordercolor="white"><label
						name="ItemName" style="size: 30;"><%=item.getItemName()%></label>
					</td>
					<td bordercolor="red" bordercolor="white"><label
						name="ItemPrice" style="size: 30;"><%=item.getItemPrice()%></label>
					</td>
					</tr>
				<%
					}
					}
				%>	
				
				<tr>
					<td align="right" colspan="3"><label name="SubTotal" style="size: 30;">SubTotal<%=subTotal%></label>
					</td>
				</tr>
				<tr>
					<td align="right" colspan="3"><label name="Tax" style="size: 30;">Tax<%=tax%></label>
					</td>
				</tr>
				<tr>
					<td align="right" colspan="3"><label name="Total" style="size: 30;">Total<%=total%></label>
					</td>
				</tr>
</body>
</html>